#ifndef _RENDERER_H_
#define _RENDERER_H_

#include <vector>
#include <list>
#include <string>
#include "Entity.h"

class Map;

class Layer
{
public:
	enum SortType
	{
		NONE,
		HORIZONTAL,
		VERTICAL,
		DEPTH
	};
	enum RenderType
	{
		NORMAL,
		BACKGROUND,
		GUI
	};
	typedef Entity* ShapeType;
	Layer(const SQChar* name);
	void render(sf::RenderWindow& window);
	void addShape(ShapeType shape);
	void removeShape(ShapeType shape);
	const wchar_t* getName() const;
	void setName(const SQChar* newName);
	void setSortType(SortType type);
	void setRenderType(RenderType type);
	void clear();
private:
	static bool xSort(const ShapeType a, const ShapeType b);
	static bool ySort(const ShapeType a, const ShapeType b);
	SortType sortType;
	std::wstring name;
	std::list<ShapeType> shapes;
};

class Renderer
{
public:
	Renderer(sf::RenderWindow& renderWindow);
	const sf::View& getCurrentView() const;
	void setView(const sf::View& view);
	const sf::RenderWindow& getWindow() const {return window;}
	void render();
	void setMap(Map* map);
private:
	sf::RenderWindow& window;
	Map* map;
};

#endif